from django.shortcuts import render, get_object_or_404
from .models import Article

def article_detail(request, article_id):
    article = get_object_or_404(Article, pk=article_id)
    context = {}
    context['article_obj'] = article
    return render(request,"article02/article_detail.html", context)
def article_list(request):
    articles = Article.objects.all()
    context = {}
    context['articles'] = articles
    return render(request,"article02/article_list.html", context)

# 这种函数表示每个模块的测试地址，如果这个地址是正常的，说明路径是没问题的
def index(request):
    context          = {}
    context['hello'] = 'Hello World!'
    return render(request,'article02/index.html',context)
